home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_usrdoc / LINUXTHR.{19 / README.{_1 < prev   
Text File  |  1999-09-17  |  6KB  |  157 lines

  1.         Linuxthreads - POSIX 1003.1c kernel threads for Linux
  2.  
  3.       Copyright 1996, 1997 Xavier Leroy (Xavier.Leroy@inria.fr)
  4.  
  5.  
  6. DESCRIPTION:
  7.  
  8. This is release 0.7 (late beta) of LinuxThreads, a BiCapitalized
  9. implementation of the Posix 1003.1c "pthread" interface for Linux.
  10.  
  11. LinuxThreads provides kernel-level threads: each thread is a separate
  12. Unix process, sharing its address space with the other threads through
  13. the new system call clone(). Scheduling between threads is handled by
  14. the kernel scheduler, just like scheduling between Unix processes.
  15.  
  16.  
  17. REQUIREMENTS:
  18.  
  19. - Linux version 2.0 and up (requires the new clone() system call
  20.   and the new realtime scheduler).
  21.  
  22. - For Intel platforms: libc 5.2.18 or later is required.
  23.   5.2.18 or 5.4.12 or later are recommended;
  24.   5.3.12 and 5.4.7 have problems (see the FAQ.html file for more info).
  25.  
  26. - Also supports glibc 2 (a.k.a. libc 6), which actually comes with
  27.   a specially-adapted version of this library.
  28.  
  29. - Currently supports Intel, Alpha, Sparc, Motorola 68k and MIPS platforms.
  30.  
  31. - Multiprocessors are supported.
  32.  
  33.  
  34. INSTALLATION:
  35.  
  36. - Edit the Makefile, set the variables in the "Configuration" section.
  37.  
  38. - Do "make".
  39.  
  40. - Do "make install".
  41.  
  42.  
  43. USING LINUXTHREADS:
  44.  
  45.         gcc -D_REENTRANT ... -lpthread
  46.  
  47. A complete set of manual pages is included. Also see the subdirectory
  48. Examples/ for some sample programs.
  49.  
  50.  
  51. STATUS:
  52.  
  53. - All functions in the Posix 1003.1c base interface implemented.
  54.   Also supports priority scheduling.
  55.  
  56. - For users of libc 5 (H.J.Lu's libc), a number of C library functions
  57.   are reimplemented or wrapped to make them thread-safe, including:
  58.   * malloc functions
  59.   * stdio functions (define _REENTRANT before including <stdio.h>)
  60.   * per-thread errno variable (define _REENTRANT before including <errno.h>)
  61.   * directory reading functions (opendir(), etc)
  62.   * sleep()
  63.   * gmtime(), localtime()
  64.  
  65.   New library functions provided:
  66.   * flockfile(), funlockfile(), ftrylockfile()
  67.   * reentrant versions of network database functions (gethostbyname_r(), etc)
  68.     and password functions (getpwnam_r(), etc).
  69.  
  70. - libc 6 (glibc 2) provides much better thread support than libc 5,
  71.   and comes with a specially-adapted version of LinuxThreads.
  72.   For serious multithreaded programming, you should consider switching
  73.   to glibc 2. It is available from prep.ai.mit.edu:/pub/gnu and its mirrors.
  74.  
  75.  
  76. WARNING:
  77.  
  78. Many existing libraries are not compatible with LinuxThreads,
  79. either because they are not inherently thread-safe, or because they
  80. have not been compiled with the -D_REENTRANT.  For more info, see the
  81. FAQ.html file in this directory.
  82.  
  83. A prime example of the latter is Xlib. If you link it with
  84. LinuxThreads, you'll probably get an "unknown 0 error" very
  85. early. This is just a consequence of the Xlib binaries using the
  86. global variable "errno" to fetch error codes, while LinuxThreads and
  87. the C library use the per-thread "errno" location.
  88.  
  89. See the file README.Xfree3.3 for info on how to compile the Xfree 3.3
  90. libraries to make them compatible with LinuxThreads.
  91.  
  92.  
  93. KNOWN BUGS AND LIMITATIONS:
  94.  
  95. - Threads share pretty much everything they should share according
  96.   to the standard: memory space, file descriptors, signal handlers,
  97.   current working directory, etc. One thing that they do not share
  98.   is their pid's and parent pid's. According to the standard, they
  99.   should have the same, but that's one thing we cannot achieve
  100.   in this implementation (until the CLONE_PID flag to clone() becomes
  101.   usable).
  102.  
  103. - The current implementation uses the two signals SIGUSR1 and SIGUSR2,
  104.   so user-level code cannot employ them. Ideally, there should be two
  105.   signals reserved for this library. One signal is used for restarting
  106.   threads blocked on mutexes or conditions; the other is for thread
  107.   cancellation.
  108.  
  109. - The stacks for the threads are allocated high in the memory space,
  110.   below the stack of the initial process, and spaced 2M apart.
  111.   Stacks are allocated with the "grow on demand" flag, so they don't
  112.   use much virtual space initially (4k, currently), but can grow
  113.   up to 2M if needed.
  114.  
  115.   Reserving such a large address space for each thread means that,
  116.   on a 32-bit architecture, no more than about 1000 threads can
  117.   coexist (assuming a 2Gb address space for user processes),
  118.   but this is reasonable, since each thread uses up one entry in the
  119.   kernel's process table, which is usually limited to 512 processes.
  120.  
  121.   Another potential problem of the "grow on demand" scheme is that
  122.   nothing prevents the user from mmap'ing something in the 2M address
  123.   window reserved for a thread stack, possibly causing later extensions of
  124.   that stack to fail. Mapping at fixed addresses should be avoided
  125.   when using this library.
  126.  
  127. - Signal handling does not fully conform to the Posix standard,
  128.   due to the fact that threads are here distinct processes that can be
  129.   sent signals individually, so there's no notion of sending a signal
  130.   to "the" process (the collection of all threads).
  131.   More precisely, here is a summary of the standard requirements
  132.   and how they are met by the implementation:
  133.  
  134.   1- Synchronous signals (generated by the thread execution, e.g. SIGFPE)
  135.      are delivered to the thread that raised them.
  136.      (OK.)
  137.  
  138.   2- A fatal asynchronous signal terminates all threads in the process.
  139.      (OK. The thread manager notices when a thread dies on a signal
  140.       and kills all other threads with the same signal.)
  141.  
  142.   3- An asynchronous signal will be delivered to one of the threads
  143.      of the program which does not block the signal (it is unspecified
  144.      which). 
  145.      (No, the signal is delivered to the thread it's been sent to,
  146.       based on the pid of the thread. If that thread is currently
  147.       blocking the signal, the signal remains pending.)
  148.  
  149.   4- The signal will be delivered to at most one thread.
  150.      (OK, except for signals generated from the terminal or sent to
  151.       the process group, which will be delivered to all threads.)
  152.  
  153. - The current implementations of the MIPS support assumes a MIPS ISA II
  154.   processor or better.  These processors support atomic operations by
  155.   ll/sc instructions.  Older R2000/R3000 series processors are not
  156.   supported yet; support for these will have higher overhead.
  157.